<template>
  <div class="app-container">
    <router-link :to="{name:'user_list',query:{userId:userId}}">
      <el-button  type='primary' v-waves>返回
      </el-button>
    </router-link>
    <div>
      <div>用户昵称：{{userInfo.nickName}}</div>
      <div>用户类型：{{userInfo.userType == 2 ?'维修人员' : userInfo.userType == 1 ? '普通用户' : '保洁人员'}}</div>
    </div>
    <div>
      <div>用户账号：{{userInfo.userPhone}}</div>
      <div>所属公司：{{userInfo.companyName}}</div>
    </div>
    <div>
      <div>手机号：{{userInfo.userPhone}}</div>
      <div>所属公司电话：{{userInfo.companyPhone}}</div>
    </div>
  </div>
</template>
<script>
import { getDetail} from '@/api/user';
export default {
    name:'user_detail',
    data(){
        return{
           userId:this.$route.query.userId,
           userInfo:{}
        }       
    },
    methods:{
        //获取用户详情
        async getDetail(){
            const {data}=await getDetail({
                userId:this.userId
            })
           this.userInfo = data.userInfo
        }
    },
    created(){
        this.getDetail()
    }
}
</script>
<style lang="scss" scoped>
.app-container>div{
    display: flex;
    justify-content: space-around;
    line-height:60px;
    color:#606266;
    div{
        width:400px;  
    }
}
</style>


